///*
// * Copyright 2006-2022 ahtelit.com, All Rights Reserved.
// */
//
//package com.telit.firecommand.controller;
//
//import com.telit.common.constant.Constant;
//import com.telit.common.entity.DataReturn;
//import com.telit.common.entity.PageData;
//import com.telit.common.util.DateUtils;
//import com.telit.firecommand.dto.*;
//import com.telit.firecommand.model.attendInfo.SaveAttendInfoRequest;
//import com.telit.firecommand.model.attendInfo.SaveNoteRequest;
//import com.telit.firecommand.model.attendInfo.SignInRequest;
//import com.telit.firecommand.service.AttendInfoService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.Date;
//import java.util.List;
//
//
///**
// * 排班信息API
// *
// * @author yuezhuang
// * @since 2023-02-17
// */
//@Slf4j
//@RequiredArgsConstructor
//@RestController
//@RequestMapping(value = "/attend", produces = MediaType.APPLICATION_JSON_VALUE)
//@Api(tags = "排班信息API", value = "排班信息API", produces = MediaType.APPLICATION_JSON_VALUE)
//public class AttendInfoController {
//
//    private final AttendInfoService attendInfoService;
//
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_POST, value = "保存排班信息（新增、修改、删除时，请传递当天所有的有效数据，只保存当前传递的数据）")
//    @PostMapping(path = "/save-attend")
//    public DataReturn<?> saveAttendInfo(@RequestBody SaveAttendInfoRequest saveAttendInfoRequest) {
//        attendInfoService.save(saveAttendInfoRequest);
//        return DataReturn.ok();
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "page", value = "当前页，分页当前页", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "limit", value = "分页条数", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "noPage", value = "是否不分页，true-不分页", paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "rank", value = "行政区划层级, 1-省 2-市 3-区县 4-乡镇 5-村（不传默认为当前一级）", paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "day", value = "查询日期 yyyy-MM-dd", required = true, paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "根据行政区划编码查询排班列表")
//    @GetMapping(path = "/qry-attend-list")
//    public DataReturn<PageData<List<AttendDTO>>> qryAttendList(@RequestParam(value = "page") Integer page,
//                                                               @RequestParam(value = "limit") Integer limit,
//                                                               @RequestParam(value = "noPage", required = false) boolean noPage,
//                                                               @RequestParam(value = "districtCode") String districtCode,
//                                                               @RequestParam(value = "rank", required = false) Integer rank,
//                                                               @RequestParam(value = "day") String day) {
//        return DataReturn.ok(attendInfoService.qryAttendList(page, limit, noPage, districtCode, rank,
//                DateUtils.getDate(day, DateUtils.DATE_FORMAT)));
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "page", value = "当前页，分页当前页", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "limit", value = "分页条数", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "noPage", value = "是否不分页，true-不分页", paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "day", value = "查询日期 yyyy-MM-dd", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "timeType", value = "日期类型：1-上午 2-下午", required = true, paramType = "query", dataType = "String"),
//    })
////    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "根据当前行政区划编码查询排班信息")
//    @GetMapping(path = "/qry-attend-info-list")
//    public DataReturn<PageData<List<AttendInfoDTO>>> qryAttendInfoList(@RequestParam(value = "page") Integer page,
//                                                                       @RequestParam(value = "limit") Integer limit,
//                                                                       @RequestParam(value = "noPage", required = false) boolean noPage,
//                                                                       @RequestParam(value = "districtCode") String districtCode,
//                                                                       @RequestParam(value = "day") String day,
//                                                                       @RequestParam(value = "timeType") Integer timeType) {
//        return DataReturn.ok(attendInfoService.qryAttendInfoList(page, limit, noPage, districtCode,
//                DateUtils.getDate(day, DateUtils.DATE_FORMAT), timeType));
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "day", value = "查询日期 yyyy-MM-dd（不传默认当天）", paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "查询当前班次")
//    @GetMapping(path = "/qry-current-attend")
//    public DataReturn<AttendInfoDTO> qryCurrentAttend(@RequestParam(value = "userId") Long userId,
//                                                      @RequestParam(value = "districtCode") String districtCode,
//                                                      @RequestParam(value = "day", required = false) String day) {
//        Date date = null;
//        if (StringUtils.isNoneBlank(day)) {
//            date = DateUtils.getDate(day, DateUtils.DATE_FORMAT);
//        }
//        return DataReturn.ok(attendInfoService.qryCurrentAttend(userId, districtCode, date));
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "day", value = "查询日期 yyyy-MM-dd（不传默认当天）", paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "查询当前班次详情")
//    @GetMapping(path = "/qry-current-info")
//    public DataReturn<CurrentAttendInfoDTO> qryCurrentInfo(@RequestParam(value = "userId") Long userId,
//                                                           @RequestParam(value = "districtCode") String districtCode,
//                                                           @RequestParam(value = "day", required = false) String day) {
//        Date date = null;
//        if (StringUtils.isNoneBlank(day)) {
//            date = DateUtils.getDate(day, DateUtils.DATE_FORMAT);
//        }
//        return DataReturn.ok(attendInfoService.qryCurrentInfo(userId, districtCode, date));
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "day", value = "查询日期 yyyy-MM-dd（不传默认当天）", paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "查询到岗统计")
//    @GetMapping(path = "/qry-attend-statistics")
//    public DataReturn<AttendStatisticsDTO> qryAttendStatistics(@RequestParam(value = "userId") Long userId,
//                                                               @RequestParam(value = "districtCode") String districtCode,
//                                                               @RequestParam(value = "day", required = false) String day) {
//        Date date = null;
//        if (StringUtils.isNoneBlank(day)) {
//            date = DateUtils.getDate(day, DateUtils.DATE_FORMAT);
//        }
//        return DataReturn.ok(attendInfoService.qryAttendStatistics(userId, districtCode, date));
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "day", value = "日期：yyyy-MM-dd", required = true, paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "查询下次排班日期")
//    @GetMapping(path = "/qry-next-attend")
//    public DataReturn<AttendInfoDTO> qryNextAttend(@RequestParam(value = "userId") Long userId,
//                                                   @RequestParam(value = "districtCode") String districtCode,
//                                                   @RequestParam(value = "day") String day) {
//        return DataReturn.ok(
//                attendInfoService.qryNextAttend(userId, districtCode, DateUtils.getDate(day, DateUtils.DATE_FORMAT)));
//    }
//
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_POST, value = "签到/签退")
//    @PostMapping(path = "/sign-in")
//    public DataReturn<?> signIn(@RequestBody SignInRequest signInRequest) {
//        attendInfoService.signIn(signInRequest);
//        return DataReturn.ok();
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "attendInfoId", value = "班次id", required = true, paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "查询班次签到信息")
//    @GetMapping(path = "/qry-sign-in")
//    public DataReturn<List<AttendRecordDTO>> qrySignIn(@RequestParam(value = "userId") Long userId,
//                                                       @RequestParam(value = "districtCode") String districtCode,
//                                                       @RequestParam(value = "attendInfoId") Long attendInfoId) {
//        return DataReturn.ok(
//                attendInfoService.qrySignIn(userId, districtCode, attendInfoId));
//    }
//
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_POST, value = "保存/修改 晨报、值班信息、交班信息、应急事务")
//    @PostMapping(path = "/save-note")
//    public DataReturn<?> saveNote(@RequestBody SaveNoteRequest saveNoteRequest) {
//        attendInfoService.saveNote(saveNoteRequest);
//        return DataReturn.ok();
//    }
//
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_POST, value = "删除 晨报、值班信息、交班信息、应急事务")
//    @PostMapping(path = "/del-note/{id}")
//    public DataReturn<?> delNote(@PathVariable("id") Long id) {
//        attendInfoService.delNote(id);
//        return DataReturn.ok();
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "attendInfoId", value = "班次id", required = true, paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "查询晨报")
//    @GetMapping(path = "/qry-daily")
//    public DataReturn<List<DailyDTO>> qryDaily(@RequestParam(value = "userId") Long userId,
//                                               @RequestParam(value = "districtCode") String districtCode,
//                                               @RequestParam(value = "attendInfoId") Long attendInfoId) {
//        return DataReturn.ok(
//                attendInfoService.qryDaily(userId, districtCode, attendInfoId));
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "attendInfoId", value = "班次id", required = true, paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "查询值班信息")
//    @GetMapping(path = "/qry-duty")
//    public DataReturn<List<DutyDTO>> qryDuty(@RequestParam(value = "userId") Long userId,
//                                             @RequestParam(value = "districtCode") String districtCode,
//                                             @RequestParam(value = "attendInfoId") Long attendInfoId) {
//        return DataReturn.ok(
//                attendInfoService.qryDuty(userId, districtCode, attendInfoId));
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "attendInfoId", value = "班次id", required = true, paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "查询交班信息")
//    @GetMapping(path = "/qry-turn")
//    public DataReturn<List<TurnDTO>> qryTurn(@RequestParam(value = "userId") Long userId,
//                                             @RequestParam(value = "districtCode") String districtCode,
//                                             @RequestParam(value = "attendInfoId") Long attendInfoId) {
//        return DataReturn.ok(
//                attendInfoService.qryTurn(userId, districtCode, attendInfoId));
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "page", value = "当前页，分页当前页", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "limit", value = "分页条数", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "noPage", value = "是否不分页，true-不分页", paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "attendInfoId", value = "班次id", required = true, paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "分页查询应急事务")
//    @GetMapping(path = "/qry-emergency")
//    public DataReturn<PageData<List<EmergencyAffairsDTO>>> qryEmergency(@RequestParam(value = "userId") Long userId,
//                                                                        @RequestParam(value = "districtCode") String districtCode,
//                                                                        @RequestParam(value = "attendInfoId") Long attendInfoId,
//                                                                        @RequestParam(value = "page") Integer page,
//                                                                        @RequestParam(value = "limit") Integer limit,
//                                                                        @RequestParam(value = "noPage", required = false) boolean noPage) {
//        return DataReturn.ok(attendInfoService.qryEmergency(page, limit, noPage, userId, districtCode, attendInfoId));
//    }
//
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "userId", value = "当前用户id", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "districtCode", value = "当前行政区划编码", required = true, paramType = "query", dataType = "String"),
//            @ApiImplicitParam(name = "attendInfoId", value = "班次id", required = true, paramType = "query", dataType = "String"),
//    })
//    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_GET, value = "查询交班人列表")
//    @GetMapping(path = "/qry-next-user")
//    public DataReturn<List<AttendInfoDTO>> qryNextUser(@RequestParam(value = "userId") Long userId,
//                                                       @RequestParam(value = "districtCode") String districtCode,
//                                                       @RequestParam(value = "attendInfoId") Long attendInfoId) {
//        return DataReturn.ok(
//                attendInfoService.qryNextUser(userId, districtCode, attendInfoId));
//    }
//
//}
